<%@ include file="../../base/include.jsp"%>

<script type="text/javascript">
	function scrollTextArea() {
		$('textarea#log').scrollTop(99999);
		$('textarea#log').scrollTop($('textarea#log').scrollTop() * 13);
	};
	$(function () {
		scrollTextArea();
	});
</script>

<c:if test="${not empty log || isBusy}">
<div class="log">
	<textarea id="log" name="log" rows="10" wrap="off" readonly>${log}</textarea>
</div>
</c:if>

<c:if test="${isBusy}">
<script>
	var id = window.setInterval('tryDoRefresh()', 1000);	
	
	function tryDoRefresh() {
		$.ajax({
			type: "post",
			url: applicationName + '/admin/advanced/ready'			
		}).done(function( result ) {
			if (result == 'true') {
				window.location.reload();
			}
			else {
				$('textarea#log').html(result);
				scrollTextArea();
			}
		});
	};
</script>
</c:if>
